package com.baseweb.webadmin.core.model.dao;

import com.baseweb.webadmin.core.model.bvo.ByUserOrderDetailInfoBvo;
import com.baseweb.webadmin.core.model.bvo.ByUserOrderEvaluatvo;
import com.baseweb.webadmin.core.model.bvo.ByUserOrderInfoBvo;
import com.baseweb.webadmin.core.model.pojo.*;
import org.joda.time.DateTime;

import java.util.List;

public interface UserOrderDao {

    public Integer insertByUserOrder(ByUserOrder byUserOrder);
    public ByUserOrder findByUserOrder(Integer id);
    public List<ByUserOrder> findByUserOrderList(List<Integer> ids);
    public List<ByUserOrder> selectListByPage(List<Integer> userIds,Integer status, Integer payStatus, Integer start, Integer offset);
    public Integer selectListCount(List<Integer> userIds,Integer status, Integer payStatus);

    public Integer insertByUserBatchPayOrder(ByUserBatchPayOrder byUserBatchPayOrder);
    public ByUserBatchPayOrder findByUserBatchPayOrder(Integer id);
    public ByUserBatchPayOrder findByUserBatchPayOrderByNum(String batchNum);

    public List<ByUserOrder> selectOrderListByBizUser(Integer userId, Integer bizUserId,Integer status, Integer payStatus, Integer start, Integer offset);
    public List<ByUserOrderEvaluatvo> selectOrderListByBizUserOfEvaluation(ByUserOrder order, Integer start, Integer offset);
    /**
     * 分页查询订单
     * @param userId
     * @param bizUserId
     * @param status
     * @param payStatus
     * @param start
     * @param offset
     * @return
     */
    public List<ByUserOrderInfoBvo> selectOrderListByPage(Integer userId,String area,Integer guserId, Integer bizUserId, Integer status, Integer payStatus,String startTime,String endTime,ByUserOrderInfoBvo user,String professionName, Integer start, Integer offset);

    /**
     * 查询订单总金额
     * @param userId
     * @param bizUserId
     * @param status
     * @param payStatus
     * @param start
     * @param offset
     * @return
     */
    public ByUserOrderInfoBvo sumPriceFromOrder(Integer userId,String area,Integer guserId, Integer bizUserId, Integer status, Integer payStatus,String startTime,String endTime,ByUserOrderInfoBvo user,String professionName, Integer start, Integer offset);

    public Integer selectOrderListByBizUserCount(Integer userId,String area,Integer guserId, Integer bizUserId,Integer status, Integer payStatus,String startTime,String endTime,String professionName,ByUserOrderInfoBvo user);
    public Integer selectOrderListByBizUserCountzOfEvalution(ByUserOrder user);

    public List<ByUserOrder> selectAllOrderListByPage(Integer userId, Integer start, Integer offset);
    public Integer selectAllOrderListCount(Integer userId);

    public Integer insertByUserOrderDetail(ByUserOrderDetail byUserOrderDetail);
    public ByUserOrderDetail findByUserOrderDetail(Integer id);
    public List<ByUserOrderDetail> selectOrderDetailListByPage(Integer userId, Integer orderId, Integer start, Integer offset);

    /**
     * 分页获取订单详情
     * @param userId
     * @param orderId
     * @param start
     * @param offset
     * @return
     */
    public List<ByUserOrderDetailInfoBvo> selectOrderDetailListByHtmlPage(Integer userId, Integer orderId, Integer start, Integer offset);
    public Integer selectOrderDetailListCount(Integer userId, Integer orderId);


    public Integer insertSchedule(ByUserBizSchedule byUserBizSchedule);
    public ByUserBizSchedule findSchedule(Integer id);
    public Integer deleteSchedule(Integer id);
    public Integer deleteSchedule(Integer type, DateTime dateTime, Integer userId);
    public Integer deleteScheduleByOrderId(Integer orderId);
    public List<ByUserBizSchedule> selectScheduleListByPage(Integer userId, Integer status, Integer start, Integer offset);
    public Integer selectScheduleListCount(Integer userId, Integer status);

    public List<ByUserBizSchedule> selectScheduleRemindList(Integer userId, Integer status, DateTime startTime, DateTime endTime);

    public List<ByUserBizSchedule> selectScheduleListByPage(Integer userId, Integer status, DateTime startTime, Integer start, Integer offset);
    public List<ByUserBizSchedule> selectScheduleListByPage(Integer userId, Integer status, DateTime startTime, DateTime endTime,Integer start, Integer offset);
    public Integer selectScheduleListCount(Integer userId, Integer status, DateTime startTime, DateTime endTime);

    public boolean isScheduled(Integer userId, Integer status, DateTime scheduleTime, Integer dinnerType);

    public List<ByUserOrder> selectBizOrderListByPage(List<Integer> userIds, Integer status, Integer start, Integer offset);
    public Integer selectBizOrderListCount(List<Integer> userIds, Integer status);

    /**
     * 查询订单评论数
     * @param id
     * @return
     */
    public Integer countOrderDiscuss(Integer id);

    /**
     * 根据产品ID查询订单状态
     * @param id
     * @return
     */
    List<ByUserOrder> selectOrderByProductId(Integer id);

    /**
     * 根据用户ID与日期判断当前日期用户是否可接单
     * @param userId 用户ID
     * @param scheduleDate 所选日期
     * @return 是否有档期
     */
    public int selectScheduleByUserId(int userId, String scheduleDate, String scheduleType);

    /**
     * 根据用户ID与档期查询是否有未完成的订单
     * @param userId 用户ID
     * @param scheduleDate 档期
     * @param scheduleType 档期类型（午宴或者晚宴）
     * @return 1 - 有未完成的订单； 0 - 没有未完成的订单
     */
    public int selectOrderUnfinished(int userId, String scheduleDate, String scheduleType);
}
